/**
 * Auto gen via dbpojo-gen.
 */
package com.us.usws.site.ipodium.action;

import javax.inject.Inject;

import com.opensymphony.xwork2.ActionSupport;
import com.us.usws.model.domain.Meeting;
import com.us.usws.model.domain.epserver.EpMscServerInfo;
import com.us.usws.service.ro.EpMscInfoROService;
import com.us.usws.service.ro.MeetingROService;

/**
 * Struts2 action
 * @author robot
 */
public class MeetingViewAction extends ActionSupport {

	private static final long serialVersionUID = 1L;

	@Inject
	private MeetingROService service;

	@Inject
	private EpMscInfoROService epService;

	private String uid;
	private Meeting meeting;

	/**
	 * review meeting, goto view meeting/whiteboard page
	 * @return
	 */
	public String reviewMeeting() {
		this.meeting = service.getMeeting(uid);
		return SUCCESS;
	}

	/**
	 * join meeting
	 * @return
	 */
	public String joinMeeting() {
		this.meeting = service.getMeeting(uid);
		return SUCCESS;
	}

	/**
	 * play meeting
	 * @return
	 */
	public String playMeeting() {
		Meeting m = service.getMeeting(uid);
		EpMscServerInfo si = epService.getServerInfoByServerType(m.getServerTypeDsid());
		m.setHost(si.getIp() + ":" + si.getPort());

		this.meeting = m;
		return SUCCESS;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public Meeting getMeeting() {
		return meeting;
	}

	public void setMeeting(Meeting meeting) {
		this.meeting = meeting;
	}

}